<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <!-- 用script来引入js文件 -->
    <script src="../js/vue.js"></script>
    <title>Document</title>
</head>
<body>
    <div class="box">
      <span>今天天气很{{info}}</span><br>
      <button @click="change">点击更换</button>
    </div>
    <script>
      //配置提示关闭
       Vue.config.productionTip = false;
        new Vue({
          el:".box",
          data:{
            isHot:true,
          },
          methods: {
            change(){
              this.isHot = !this.isHot
            }
          },
          computed:{
            info:{
              get(){
                return this.isHot ? "炎热":"凉爽";
              }
            }
          },
          watch:{
            isHot:{
              immediate:true,
              handler(newValue,oldValue){
                return newValue
              }
            }
          }
        })
    </script>
</body>
</html>